Skip to content

Conversation

@shafik
Copy link
Collaborator

@shafik shafik commented Jun 4, 2025

Static analysis flagged this since we could move MergedRanges since it is a std::vector, a local and unused after that line. So there is a potential saving.

Static analysis flagged this since we could move MergedRanges since it is a
std::vector, a local and unused after that line. So there is a potential saving.
@llvmbot llvmbot added the clang Clang issues not falling into any other category label Jun 4, 2025
@llvmbot
Copy link
Member

llvmbot commented Jun 4, 2025

@llvm/pr-subscribers-clang

Author: Shafik Yaghmour (shafik)

Changes

Static analysis flagged this since we could move MergedRanges since it is a std::vector, a local and unused after that line. So there is a potential saving.


Full diff: https://github.com/llvm/llvm-project/pull/142851.diff

1 Files Affected:

  • (modified) clang/lib/Frontend/FrontendAction.cpp (+1-1)
diff --git a/clang/lib/Frontend/FrontendAction.cpp b/clang/lib/Frontend/FrontendAction.cpp
index af9d18ab66108..ef7ae27a2694a 100644
--- a/clang/lib/Frontend/FrontendAction.cpp
+++ b/clang/lib/Frontend/FrontendAction.cpp
@@ -181,7 +181,7 @@ class DeserializedDeclsSourceRangePrinter : public ASTConsumer,
         if (MergedRanges.back().second < It->second)
           MergedRanges.back().second = It->second;
       }
-      Result.push_back({Data.Ref->getName(), MergedRanges});
+      Result.push_back({Data.Ref->getName(), std::move(MergedRanges)});
     }
     printJson(Result);
   }

Copy link
Collaborator

@AaronBallman AaronBallman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@shafik shafik merged commit cd5c555 into llvm:main Jun 5, 2025
13 checks passed
@shafik shafik deleted the frontendactions_handleTranslatonUnit_use_move_mergedranges branch June 16, 2025 20:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clang Clang issues not falling into any other category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants